import { HospitalSetItem, ReqAddHospitalParams, ReqGetHospitalSetParams, ReqGetHospitalSetResponse, ReqUpdateHospitalSet } from "./model/hospitalSetTypes";
import {request} from '@utils/http';
/**
 * 请求获取医院列表的数据
 */
export function reqGetHospitalSet({page, limit, hosname, hoscode}: ReqGetHospitalSetParams){
  //发送请求
  return request.get<any, ReqGetHospitalSetResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
    params: {
      hosname,
      hoscode,
    }
  });
}

/**
 * 请求新增医院设置的信息
 */
export function reqAddHospitalSet(data: ReqAddHospitalParams){
  return request.post<any, null>('/admin/hosp/hospitalSet/save', data);
}


/**
 * 获取单个医院的信息
 */
export function reqGetHospitalSetById(id: string){
  return request.get<any, HospitalSetItem>(`/admin/hosp/hospitalSet/get/${id}`);
}

/**
 * 更新单个医院的信息
 */
export function reqUpdateHospitalSet(data: ReqUpdateHospitalSet){
  return request.put<any, null>('/admin/hosp/hospitalSet/update', data);
}

/**
 * 删除某个医院的信息
 */
export function reqRemoveHospitalSet(id: string){
  return request.delete(`/admin/hosp/hospitalSet/remove/${id}`);
}

/**
 * 根据 id 列表批量删除医院设置信息
 */
export function reqBatchRemoveByIds(idList: number[]){
  return request.delete<any, null>('/admin/hosp/hospitalSet/batchRemove', {
    data: idList
  });
}